package com.icode.core.dto.house;

import com.icode.core.model.house.ExchangePool;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-6-8
 * Time: 下午3:53
 * To change this template use File | Settings | File Templates.
 */
public class ExchangePoolDTO {

    private String guid;
    private HouseInfoDTO houseInfoDTO;
    private String houseWeekName;
    private String houseWeekPrice;
    private String userInfoGuid;
    private String username;

    public ExchangePoolDTO() {
    }

    public ExchangePoolDTO(String guid, HouseInfoDTO houseInfoDTO, String houseWeekName, String houseWeekPrice, String userInfoGuid, String username) {
        this.guid = guid;
        this.houseInfoDTO = houseInfoDTO;
        this.houseWeekName = houseWeekName;
        this.houseWeekPrice = houseWeekPrice;
        this.userInfoGuid = userInfoGuid;
        this.username = username;
    }

    public static ExchangePoolDTO toDTO(ExchangePool exchangePool) {
        HouseInfoDTO houseInfoDTO = HouseInfoDTO.toDTO(exchangePool.myHouse().houseInfo());
        return new ExchangePoolDTO(exchangePool.guid(), houseInfoDTO, exchangePool.myHouse().houseWeek().name(), exchangePool.myHouse().houseWeek().price(), exchangePool.myHouse().userInfo().guid(), exchangePool.myHouse().userInfo().username());
    }

    public static List<ExchangePoolDTO> toDTOs(List<ExchangePool> exchangePools) {
        List<ExchangePoolDTO> exchangePoolDTOs = new ArrayList<>();
        for (ExchangePool e : exchangePools) {
            exchangePoolDTOs.add(toDTO(e));
        }
        return exchangePoolDTOs;
    }

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getUserInfoGuid() {
        return userInfoGuid;
    }

    public void setUserInfoGuid(String userInfoGuid) {
        this.userInfoGuid = userInfoGuid;
    }

    public HouseInfoDTO getHouseInfoDTO() {
        return houseInfoDTO;
    }

    public void setHouseInfoDTO(HouseInfoDTO houseInfoDTO) {
        this.houseInfoDTO = houseInfoDTO;
    }

    public String getHouseWeekName() {
        return houseWeekName;
    }

    public void setHouseWeekName(String houseWeekName) {
        this.houseWeekName = houseWeekName;
    }

    public String getHouseWeekPrice() {
        return houseWeekPrice;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setHouseWeekPrice(String houseWeekPrice) {
        this.houseWeekPrice = houseWeekPrice;
    }
}
